//@author A0121492M
public class UndoCommand extends Command {

	public ExecutionReply execute() throws ActionUnavailableException {
		CommandReply r = new CommandReply();
		
		if (Logic.lastCommand == -1) {
			throw new ActionUnavailableException();
		}
		
		Command command = Logic.commandHistory.get(Logic.lastCommand);
		r.command = command;
		command.undo();
		Logic.lastCommand--;
		Logic.saveData();
		return r;
	}
}
